from .base import BaseConfig
from utils import device, common


class DeviceConfig(BaseConfig):
    def __init__(self, path):
        super().__init__(path)

    def get_version(self):
        return common.get_data_value(self.__config, "version") or "-"

    def is_debug(self):
        debug = common.get_data_value(self.__config, "debug")
        return debug == 1

    def get_hostname(self):
        hostname = common.get_data_value(self.__config, "hostname")

        if not hostname:
            hostname = str(device.sysname)
        return hostname

    def get_address(self):
        return common.get_data_value(self.__config, "address")

    def get_description(self):
        return common.get_data_value(self.__config, "description")
